package com.liang.threaddemo3;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();

        //创建runnable 对象
        FutureTask<String> ft = new FutureTask<>(mc);

        //创建线程对象
        Thread tr = new Thread(ft);

        //启动线程
        tr.start();

        //线程结束后打印结果
        System.out.println(ft.get());
    }
}
